package fr.pascal.hibernate_spring.stock.dao;

import org.springframework.stereotype.Repository;

import fr.pascal.hibernate_spring.stock.model.Stock;
import fr.pascal.hibernate_spring.stock.util.CustomHibernateDaoSupport;

@Repository("stockDao")
public class StockDaoImpl extends CustomHibernateDaoSupport implements StockDao {

	public void save(Stock stock) {
		getHibernateTemplate().save(stock);
	}

	public void update(Stock stock) {
		getHibernateTemplate().update(stock);
	}

	public void delete(Stock stock) {
		getHibernateTemplate().delete(stock);
	}

	public Stock findByStockCode(String stockCode) {
		return getHibernateTemplate().load(Stock.class, stockCode);
	}
}
